/**
 * <p>Title: MobContainer.java</p>
 * <p>Description: CS 343 Final Project. This class contains the mob container for the game</p>
 * @author Tim Olmstead, Brady Fetting, Erik Brown, Thales Kirk
 * @email timothy.olmstead@my.uwrf.edu, brady.fetting@my.uwrf.edu, 
 * 			erik.brown@my.uwrf.edu, thales.kirk@my.uwrf.edu
 * @date November 15, 2013
 */

package Charactors;

import java.util.Vector;

import Settings.Config;

public class MobContainer {
	public Vector<Mob> mobs;

	/**
	 * @param none
	 * @description gets the mob for the game, ie the eagle
	 */
	public synchronized Vector<Mob> getMobs() {
		return mobs;
	}

	/**
	 * @param none
	 * @description clears the game of the mob object
	 */
	public void clearContainer() {
		mobs.clear();
	}

	/**
	 * @param none
	 * @description creates a new mob for the game
	 */
	public MobContainer() {
		mobs = new Vector<Mob>();
	}

	/**
	 * @param x
	 * @description adds a mob to the game
	 */
	public synchronized void add(Mob x) {
		mobs.add(x);
	}

	/**
	 * @param x
	 * @description removes the mob from the game
	 */
	public synchronized void remove(Mob x) {
		mobs.remove(x);
	}

	/**
	 * @param none
	 * @description moves the mob across the screen
	 */
	public synchronized void move() {
		Vector<Mob> mobtoremove = new Vector<Mob>();
		if (mobs.isEmpty()) {
			return;
		}
		for (Mob x : mobs) {
			if (x.getxLoc() > Config.FRAME_WIDTH)
				mobtoremove.add(x);
			else
				x.move();
		}
		if (!mobtoremove.isEmpty()) {
			for (Mob x : mobtoremove) {
				remove(x);
			}
		}
	}

}
